import { createSlice } from '@reduxjs/toolkit'

type TLoadingState = {
	isLoading: boolean
}

const initialState: TLoadingState = {
	isLoading: false,
}

const sliceName = 'loading'

export const loadingSlice = createSlice({
	name: sliceName,
	initialState,
	reducers: {
		setLoading: (state, action) => {
			state.isLoading = action.payload
		},
	},
})
